#ifndef __USART_H
#define __USART_H
#include "stdio.h"
#include "bsp_sys.h"

#ifndef _USART_
#define _USART_
#define UART_NUM   3
#endif

#ifndef _DATA_BUF_
#define _DATA_BUF_ 
typedef struct{
	u8 *pBuf;
	u16 size;
}STRUCT_DATA_BUF;
#endif

#ifndef _STRUCT_FIFO_
#define _STRUCT_FIFO_
typedef struct{
	u8 *pFFData;		//data buffer pointer
	u16 FFDepth;		//FIFO depth
	u16 FFValidSize;	//valid data size in FIFO
	u16 FFInOffset;		//index of FIFO in
	u16 FFOutOffset;	//index of FIFO out
}STRUCT_FIFO;
#endif

typedef enum{
	BOUND9600	= 9600,
	BOUND57600	= 57600,
	BOUND115200 = 115200
}USART_BOUND_RATE;


//定义配置使能
#define USART1_CONFIG_ENABLED                (1)
#define USART2_CONFIG_ENABLED                (0)
#define USART3_CONFIG_ENABLED                (0)


extern void USART_Config(void);
extern u16 USART1_GetRxFFValidSize(void);
extern u8 USART1_RecBuf(u8* pBuf, u16 len);
extern void USART_SendByte(USART_TypeDef* USARTx, u8 byte);
extern void USART_SendBuf(USART_TypeDef* USARTx, u8 *str, u16 len);
extern u16 USART1_GetRxTotleDataLen(void);




#endif


